{% extends "bootstrap/base.html" %}

{% block title %}Flask_Sqlachemy_RESTfulAPI_Codegen{% endblock %}

{% block styles %}
    {{ super() }}
    <link rel="stylesheet" href="../static/css/global.css">
    <link rel="stylesheet" href="../static/css/table.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script>
        $(function () {
            $("[data-toggle='tooltip']").tooltip();
        });
    </script>
    <script type="text/javascript" src="../static/js/table.js"></script>
    <script type="text/javascript">
        let data = []
    </script>
{% endblock %}

{% block content %}

    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">Flask_Sqlachemy_RESTfulAPI_Codegen</h3>
        </div>
        <div class="panel-body">
            <h2> 数据表准备 </h2>
            选择用于生成代码的数据表，并为每张表进行相应的配置
        </div>

        <div class="panel-body">


            <div class="table-index">

                <div class="navbar navbar-default nav-table" role="navigation">
                    <ul class="nav nav-pills nav-stacked">
                        {% for item in data %}
                            <script type="text/javascript">
                                data.push("{{item}}")
                            </script>
                            <li onclick=setActive()><a id="{{ item.table }}" onclick=toTableInfo()>{{ item.table }}<span
                                    class="glyphicon glyphicon-cog"></span></a>
                            </li>
                        {% endfor %}
                    </ul>
                </div>
            </div>


            <div class="table-info">

                <div>
                    <h3 id="tableName">Table</h3>
                    <label><input type="checkbox" id="isDeleted">是否逻辑删除</label>
                    <a class="tooltip-test" data-toggle="tooltip" data-html="true"
                       title="表记录采用逻辑删除方式<br/>注:设计表时必须包含IsDelete字段"><span
                            class="glyphicon glyphicon-question-sign"></span></a>

                </div>

                <div>
                    <label>字段加密</label>
                    <a class="tooltip-test" data-toggle="tooltip" data-html="true"
                       title="请勾选加密的字段<br/>RSA公私钥请在security.conf中配置"><span
                            class="glyphicon glyphicon-question-sign"></span></a>
                    <div class="navbar navbar-default nav-field" role="navigation">
                        <ul class="nav nav-pills nav-stacked" id="filed">
                        </ul>
                    </div>
                </div>

                <div>
                    <label><input type="checkbox" id="isBusinessKey" onclick=businessKey()>是否存在业务主键</label>
                    <a class="tooltip-test" data-toggle="tooltip" data-html="true"
                       title="请勾选是否存在业务主键"><span
                            class="glyphicon glyphicon-question-sign"></span></a>
                </div>

                <div id="businessKeyRule">
                    <label>业务主键</label>
                    <select class="form-control" id="selectBusinessKey">
                    </select>
                    <label>业务主键生成规则</label>
                    <a class="tooltip-test" data-toggle="tooltip" data-html="true"
                       title="业务主键生成规则使用已定义的规则：‘create_id_by_autoID’,‘create_hashlib_id’,‘create_uid’.以及无生成规则，默认为无生成规则"><span
                            class="glyphicon glyphicon-question-sign"></span></a>

{#                    <input type="text" class="form-control" id="textRule">#}
                    <select class="form-control" id="textRule">
                        <option></option>
                        <option>create_id_by_autoID</option>
                        <option>create_hashlib_id</option>
                        <option>create_uid</option>

                    </select>
                </div>

                <div class="btn-save">
                    <button type="button" class="btn btn-primary" onclick=saveTableInfo()>保存</button>
                    <button type="button" class="btn btn-danger" onclick=removeTableInfo()>清空</button>
                </div>
                <div class="alert alert-success alert-save" id="btn-save">保存成功！</div>
            </div>
        </div>

        <div class="panel-body btn-body">
            <button type="button" class="btn btn-primary" onclick="window.history.back()">
                <span class="glyphicon glyphicon-arrow-left"></span>
            </button>
            <button type="submit" class="btn btn-primary btn-next" onclick="sendData()">下一步</button>
        </div>

        <div class="panel-footer">
        </div>
    </div>

{% endblock %}

